/*
 * BuddySystem.h
 *
 *  Created on: Mar 2, 2011
 *      Author: jelle
 */
#pragma once
#ifndef BUDDYSYSTEM_H_
#define BUDDYSYSTEM_H_

#include <math.h>
#include <iostream>

#include "Area.h"
#include "Allocator.h"
#include "Buddy.h"

class BuddySystem : public Allocator {
private:
	Buddy**  memoryAdministration;

	Buddy*   findSpace(int,int);
public:
	BuddySystem() : Allocator("BuddySystem") {
	}
	virtual ~BuddySystem(){
		//TODO ben zeurt
		delete memoryAdministration;
	}

	void setSize(int xxx) {
			Allocator::setSize(xxx);
			memoryAdministration = new Buddy *[size];
			memoryAdministration[1] = new Buddy();
	}
	const Area * alloc(int wanted); // gebied vragen
	void free(const Area * ap); // gebied teruggeven
	void joinBuddys(int buddy);
};

#endif /* BUDDYSYSTEM_H_ */
